﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GA.Shared.Interfaces;
using System.Windows;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using System.Windows.Data;
using GA.Shared.Objects;
using GA.Server.DatabaseManager;

namespace GA.Server.Objects
{
    public class DatabaseAlliance : DatabaseObject
    {
        /// <summary>
        /// Identifies the Id Property.
        /// </summary>
        public static readonly DependencyProperty IdProperty =
            DependencyProperty.Register(
                "Id",
                typeof(int),
                typeof(DatabaseAlliance),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the GameId Property.
        /// </summary>
        public static readonly DependencyProperty GameIdProperty =
            DependencyProperty.Register(
                "GameId",
                typeof(int),
                typeof(DatabaseAlliance),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the Name Property.
        /// </summary>
        public static readonly DependencyProperty NameProperty =
            DependencyProperty.Register(
                "Name",
                typeof(string),
                typeof(DatabaseAlliance),
                new PropertyMetadata(string.Empty));

        /// <summary>
        /// Identifies the LeaderId Property.
        /// </summary>
        public static readonly DependencyProperty LeaderIdProperty =
            DependencyProperty.Register(
                "LeaderId",
                typeof(int),
                typeof(DatabaseAlliance),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the Leader Property.
        /// </summary>
        public static readonly DependencyProperty LeaderProperty =
            DependencyProperty.Register(
                "Leader",
                typeof(Agency),
                typeof(DatabaseAlliance),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the Agencies Property.
        /// </summary>
        public static readonly DependencyProperty AgenciesProperty =
            DependencyProperty.Register(
                "Agencies",
                typeof(ObservableCollection<Agency>),
                typeof(DatabaseAlliance),
                new PropertyMetadata(-1));

        /// <summary>
        /// Gets or sets the Id.
        /// </summary>
        
        [DatabaseField("Id", IsIdentity = true, IsKey = true)]
        public int Id
        {
            get { return (int)SafeGetValue(IdProperty); }
            set { SafeSetValue(IdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Name.
        /// </summary>
        
        [DatabaseField("Name", IsKey = true, IsQuoted = true)]
        public string Name
        {
            get { return (string)SafeGetValue(NameProperty); }
            set { SafeSetValue(NameProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Leader Id.
        /// </summary>
        
        [DatabaseField("LeaderId")]
        public int LeaderId
        {
            get { return (int)SafeGetValue(LeaderIdProperty); }
            set { SafeSetValue(LeaderIdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Leader.
        /// </summary>
        
        public Agency Leader
        {
            get { return (Agency)SafeGetValue(LeaderProperty); }
            set { SafeSetValue(LeaderProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Agencies.
        /// </summary>
        
        public ObservableCollection<Agency> Agencies
        {
            get { return (ObservableCollection<Agency>)SafeGetValue(AgenciesProperty); }
            set { SafeSetValue(AgenciesProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Game Id.
        /// </summary>
        
        [DatabaseField("GameId", IsKey = true)]
        public int GameId
        {
            get { return (int)SafeGetValue(GameIdProperty); }
            set { SafeSetValue(GameIdProperty, value); }
        }

        public DatabaseAlliance()
        {
        }

        public DatabaseAlliance(LinkedDependencyObject baseObject)
            : base(baseObject)
        {
        }

        public DatabaseAlliance(LinkedDependencyObject baseObject, BindingMode bindingMode)
            : base(baseObject, bindingMode)
        {
        }

        public override void LoadAllPropertyObjects()
        {
            #warning Not Implemented
        }

        public override void LoadPropertyObject(string propertyName)
        {
            #warning Not Implemented
        }
    }
}
